﻿$(document).ready(function () {
    $("#ModalitySelect").change(function () {
        var Modalityid = $("#ModalitySelect").val();
        $("#ProductSelect").empty().append("<option value=''>Select Product</option>");
        if (Modalityid != "") {
            $.ajax({
                type: "GET",
                url: "/Product/GetProductByMID",
                data: { id: Modalityid },
                dataType: "json",
                success: function (data) {
                    if (data.length > 0) {
                        for (var item in data) {

                            $("#ProductSelect").append("<option value='" + data[item].ProductID + "'>" + data[item].ProductName + "</option>");
                        }
                    }
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {

                }
            });
        }
    })
})